Use QtLogging Message Pattern to replace MYNAME (#1367)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 7 Nov 2024 17:03:01 +0000 (10:03 -0700)
committerGitHub <noreply@github.com>
Thu, 7 Nov 2024 17:03:01 +0000 (10:03 -0700)
commite3c01bc8d073e8c0e1b1589406596bd3bbe063eb
treeb7639a26f9fff7cf851ee05bd8129a69aad1ffe8
parentdfadba0a59c3adaf18a2e1f0cca86da2c276f7c6
Use QtLogging Message Pattern to replace MYNAME (#1367)

* use qlogging message pattern to replace MYNAME.

* first cut at removal of MYNAME.

* add message type support

and massage some logging with internal newlines.

* introduce DebugLog class to transform printf ...

style character output into lines suitable for logging.

* handle debug printing in garmin_gpi

including removal of POSIX printf arguement reordring

* use DebugLog with lowranceusr

* use DebugLog in dg100

* fix logging in garmin_txt

* use DebugLog in exif

* use logging for validate.

* fix includes

* use DebugLog in igc

* use logging in kml

* use logging in garmin

* use DebugLog in mtk.

* use DebugLog in tpo

* use logging in trackfilter

* use DebugLog for v900

* use DebugLog in skytraq

* use logging with nmea.

* fix dg100, update references, chop extra newlines.

* appease MSVC C2131

* fix garmin_gpi address debug messages.

and direct vecs debug output to debug msg.

* fix comparison with testo -D 9 igc format

* match globalsat sport ws debug messages

* match ws on fatal()

* update references for option->stderr and

no extra newline on fatal.

* ws

* don't send empty string to QDebug.

* drop another empty string from logging.

* cleanup fatal, flush is done in message handler.

* move conditional logging check earlier.

* make member functions static

* fix debug build.

* eliminate some QString<->QByteArray round trips.

* purse QStrings from fatal routines.

Besides an efficiency hit any variadic argument strings passed to these
routines should already be in local8Bit.

* rename logging functions for easier script editing.

thanks clion.

* add macro gbLogCStr for use with our logging.

All but one line was changed by sed (ok, the sed script took
a few tries.)
This allows us to change the encoding passed to our printf style
logging routines in one place.

* change logging back to using QStrings.

QtMessageHandler operates on QStrings.

* manual rename logging routines in windows only files.

* use global gbLog instead of DebugLog instances.

* convert all gb printflike logging to accumulate lines.

* use gbDebug instead of gbLog.  They are equivalent.

* remove unecessary choping.

* fix getLogString, flush fatal log stream.

* terminate gbFatal format strings with a newline.

Since we flush this isn't necessary, but let's be consistent.

* terminate gbWarning format strings.

* switch to our own MessageHandler for legacy logging.

We don't delay logging until we have a complete line, instead
we output any bits as we go.  We only format the log message if
the last output for the first message or if the last output
character was a newline.

* rename LegacyLog components.

* update fatal.cc includes

* use same stream in waypt_status_disp & termination in waypt_disp_session.

stderr is a text stream which should translate '\n' -> '\r\n' on windows
automatically.

* review catches, mostly in comments or dead code.
113 files changed:
arcdist.cc
bend.cc
csv_util.cc
defs.h
dg-100.cc
dg-100.h
discard.cc
duplicate.cc
exif.cc
exif.h
fatal.cc
filter_vecs.cc
format.h
format_skeleton.cc
garmin.cc
garmin_fit.cc
garmin_gpi.cc
garmin_gpi.h
garmin_tables.cc
garmin_tables.h
garmin_txt.cc
garmin_xt.cc
gbfile.cc
gbfile.h
gbser.cc
gbser_posix.cc
gbser_win.cc
gdb.cc
geo.cc
geojson.cc
geojson.h
globalsat_sport.cc
globalsat_sport.h
googletakeout.cc
googletakeout.h
gpx.cc
gtm.cc
gtrnctr.cc
height.cc
html.cc
humminbird.cc
igc.cc
igc.h
inifile.cc
inifile.h
interpolate.cc
jeeps/gpsapp.cc
jeeps/gpscom.cc
jeeps/gpslibusb.cc
jeeps/gpsmath.cc
jeeps/gpsserial.cc
jeeps/gpsusbcommon.cc
jeeps/gpsusbwin.cc
kml.cc
lowranceusr.cc
lowranceusr.h
main.cc
mkshort.cc
mtk_logger.cc
nmea.cc
nmea.h
nukedata.cc
osm.cc
ozi.cc
parse.cc
polygon.cc
position.cc
qstarz_bl_1000.cc
radius.cc
reference/badopt1.txt
reference/badopt2.txt
reference/badopt3.txt
reference/badopt4.txt
reference/dg200erase.log
reference/mkshort3.log
reference/track/trackfilter_discard_err.gpx
reference/validate_debug.log
reference/validate_empty.log
resample.cc
reverse_route.cc
rgbcolors.cc
session.cc
shape.cc
skytraq.cc
skytraq.h
smplrout.cc
sort.cc
src/core/codecdevice.cc
src/core/codecdevice.h
src/core/file.h
src/core/logging.h
src/core/textstream.cc
src/core/textstream.h
src/core/xmlstreamwriter.cc
stackfilter.cc
subrip.cc
swapdata.cc
text.cc
tpg.cc
tpo.cc
trackfilter.cc
transform.cc
unicsv.cc
units.cc
util.cc
v900.cc
validate.cc
validate.h
vcf.cc
vecs.cc
waypt.cc
xcsv.cc
xmlgeneric.cc